<?php
/**
 * 成员-客户表模型
 */
namespace app\msgapi\model;

use think\model\concern\SoftDelete;

class UserCust extends BaseModel
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;

    public function getRemarkMobilesAttr($value){
        return json_decode($value,true);
    }
    public function getTagidsAttr($value){
        return json_decode($value,true);
    }
    public function cust()
    {
        return $this->hasOne(Cust::class, 'id', 'external_uid')->bind(['name', 'cust_avatar' => 'avatar', 'type', 'gender', 'corp_name']);
    }

    public function user()
    {
        return $this->hasOne(User::class, 'id', 'uid')->bind(['username' => 'name','user_gender'=>'gender','user_position'=>'position','userid','user_avatar'=>'avatar']);
    }

}